package com.als.healthymananger.controller;


import com.als.healthymananger.entity.Diet;
import com.als.healthymananger.utils.RespBean;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Tag(name = "知识库-膳食库", description = "增删改查")
public interface DietsApi {
    /**
     * 添加膳食
     */
    @PostMapping("/")
    @Operation(summary = "添加膳食", description = "添加膳食", security = @SecurityRequirement(name = "bearer-key"))
    @io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content(mediaType = "application/json;characterset=UTF-8", schema = @Schema(ref = "diet")))
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "添加成功"),
            @ApiResponse(responseCode = "400", description = "添加失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean createDiets(@RequestBody @Validated Diet diet);

    /**
     * 删除膳食
     */
    @DeleteMapping("/{dietId}")
    @Operation(summary = "删除膳食", description = "删除膳食", security = @SecurityRequirement(name = "bearer-key"))
    @Parameter(name = "dietId", description = "膳食序列", in = ParameterIn.PATH, required = true)
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "删除成功"),
            @ApiResponse(responseCode = "400", description = "删除失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean deleteDiets(@PathVariable("dietId")int dietId);

    /**
     * 修改膳食
     */
    @PutMapping("/{dietId}")
    @Operation(summary = "修改膳食", description = "修改膳食", security = @SecurityRequirement(name = "bearer-key"))
    @Parameters({
            @Parameter(name = "dietId", description = "膳食序列", in = ParameterIn.PATH, required = true),
    })
    @io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content(mediaType = "application/json;characterset=UTF-8", schema = @Schema(ref = "diet")))
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "修改成功"),
            @ApiResponse(responseCode = "400", description = "修改失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean updateDiets(@PathVariable("dietId")int dietId,
                                  @RequestBody @Validated Diet diet);

    /**
     * 获取膳食信息
     */
    @GetMapping("/{dietId}")
    @Operation(summary = "获取膳食信息", description = "获取膳食信息", security = @SecurityRequirement(name = "bearer-key"))
    @Parameter(name = "dietId", description = "膳食序列", in = ParameterIn.PATH, required = true)
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "获取成功"),
            @ApiResponse(responseCode = "400", description = "获取失败"),
            @ApiResponse(responseCode = "401", description = "用户未登录"),
            @ApiResponse(responseCode = "403", description = "权限不足"),
            @ApiResponse(responseCode = "412", description = "先决条件不足，如数据格式不对")
    })
    public RespBean getDiets(@PathVariable("dietId")int dietId);
}
